package online.afeibaili.storebackendframework.service.impl

import online.afeibaili.storebackendframework.model.AddressEntity
import online.afeibaili.storebackendframework.repository.AddressRepository
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
import kotlin.jvm.optionals.getOrElse


/**
 * 订单逻辑层
 *
 *@author AfeiBaili
 *@version 2025/11/20 20:33
 */

@Service
class AddressServiceImpl {
    @Autowired
    lateinit var repository: AddressRepository

    fun save(address: AddressEntity): AddressEntity {
        return repository.save(address)
    }

    fun getById(id: String): AddressEntity? {
        return repository.findById(id).getOrElse { return null }
    }
}